import { fromEvent, interval, map, take } from "rxjs";
import { exhaustAll } from "rxjs/operators";

const clicks = fromEvent(document, "click");
const higherOrder = clicks.pipe(map(() => interval(1000).pipe(take(5))));
const result = higherOrder.pipe(exhaustAll());

result.subscribe((x) => console.log("exhaustAll:", x));
